import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'

export default defineUniPages({
  globalStyle: {
    navigationStyle: 'default',
    navigationBarTitleText: 'HUB',
    navigationBarTextStyle: 'black',
    backgroundColor: '#4cd964', // 背景色
    backgroundColorTop: '#e50038', // 顶部窗口的背景色
    backgroundColorBottom: '#f4f5f7', // 底部窗口的背景色
  },
  easycom: {
    autoscan: true,
    custom: {
      '^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue',
      '^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)':
        'z-paging/components/z-paging$1/z-paging$1.vue',
      '^uv-(.*)': '@climblee/uv-ui/components/uv-$1/uv-$1.vue',
      '^@/components/(.*)': '@/components/$1/$1.vue',
    },
  },
  pages: [
    {
      path: 'pages/home/index',
      type: 'home',
      style: {
        navigationStyle: 'custom',
        navigationBarTitleText: '首页',
        navigationBarBackgroundColor: '#FFFFFF',
        disableScroll: false, // 禁止下拉刷新
      },
      needLogin: false,
    },
    {
      path: 'pages/service/index',
      type: 'page',
      style: {
        navigationStyle: 'custom',
        navigationBarTitleText: '服务',
        navigationBarBackgroundColor: '#FFFFFF',
      },
      needLogin: false,
    },
    {
      path: 'pages/my/index',
      type: 'page',
      style: {
        navigationStyle: 'custom',
        navigationBarTitleText: '我的',
        navigationBarBackgroundColor: '#FFFFFF',
      },
      needLogin: false,
    },
  ],
  subPackages: [
    {
      root: 'pages-sub',
      pages: [
        {
          path: 'login/index',
          style: {
            navigationBarTitleText: '登录',
            navigationStyle: 'custom',
            navigationBarBackgroundColor: '#cccccc',
          },
          needLogin: false,
        },
        {
          path: 'viewReport/index',
          style: {
            navigationStyle: 'custom',
            navigationBarTitleText: '我的报告',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: true,
        },
        {
          path: 'deviceList/index',
          style: {
            navigationStyle: 'custom',
            navigationBarTitleText: '我的设备',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: true,
        },
        {
          path: 'reportDetail/index',
          style: {
            navigationBarTitleText: '报告详情',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: true,
        },
        {
          path: 'advertisement/index',
          style: {
            navigationBarTitleText: '产品详情',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: false,
        },
        {
          path: 'reservation/index',
          style: {
            navigationStyle: 'custom',
            navigationBarTitleText: '预约登记',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: true,
        },
        {
          path: 'information/index',
          style: {
            navigationStyle: 'custom',
            navigationBarTitleText: '个人信息',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: true,
        },
        {
          path: 'agreement/privacy',
          style: {
            navigationBarTitleText: '心康用户注册协议',
            navigationStyle: 'custom',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: false,
        },
        {
          path: 'agreement/registration',
          style: {
            navigationBarTitleText: '心康隐私协议',
            navigationStyle: 'custom',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: false,
        },
        {
          path: 'agreement/userKnow',
          style: {
            navigationBarTitleText: '用户知情协议书',
            navigationStyle: 'custom',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: false,
        },
        {
          path: 'operating/index',
          style: {
            navigationBarTitleText: '操作指引',
            navigationStyle: 'custom',
            navigationBarBackgroundColor: '#FFFFFF',
          },
          needLogin: false,
        },
      ],
    },
  ],
  preloadRule: {
    'pages/my/index': {
      network: 'all',
      packages: ['pages-sub'],
    },
  },
  tabBar: {
    color: '#999999',
    selectedColor: '#018d71',
    backgroundColor: '#F8F8F8',
    borderStyle: 'black',
    height: '50px',
    fontSize: '10px',
    iconWidth: '24px',
    spacing: '3px',
    custom: false,
    list: [
      {
        iconPath: '/static/tabbar/home.png',
        selectedIconPath: '/static/tabbar/homeHL.png',
        pagePath: 'pages/home/index',
        text: '首页',
      },
      {
        iconPath: '/static/tabbar/server.png',
        selectedIconPath: '/static/tabbar/serverHL.png',
        pagePath: 'pages/service/index',
        text: '服务',
      },
      {
        iconPath: '/static/tabbar/my.png',
        selectedIconPath: '/static/tabbar/myHL.png',
        pagePath: 'pages/my/index',
        text: '我的',
      },
    ],
  },
})
